package com.lyrpx;

public class HelloSpring {
    private String name;
    private int age;
   public HelloSpring(){
       name="Rose";
   }
   //1构造方法注入
    public HelloSpring(String name){
        this.name=name;
    }
    public HelloSpring(String name,int age){
       this.name=name;
       this.age=age;
    }
    //2属性setter方法注入
    public void setName(String name) {
        this.name = name;
    }
    public void setAge(int age) {
        this.age = age;
    }
    public void print(){
        System.out.println("欢迎"+age+"岁的"+name+"来到spring...");
    }
}
